<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>文本智能匹配背景</title>
    <style>
      .banner {
        display: flex;
        justify-content: center;
        align-items: center;
        background: linear-gradient(
          135deg,
          white 50%,
          black 50%
        ); /* 设置渐变背景颜色，白色和黑色各占一半 */
      }
      .title {
        color: #fff;
        font-size: 3rem;
        transition: 0.5s;
        /* 混合像素点属性 */
        mix-blend-mode: difference;
      }
      .banner:hover .title {
        transform: translateX(-100px);
      }
    </style>
  </head>
  <body>
    <div class="banner">
      <h1 class="title">天生我材 必有用</h1>
    </div>
  </body>
</html>
